<html><head>
    <meta charset="utf-8">
	<title>在线选品</title>
    <meta name="csrf-token" content="{{ csrf_token() }}">
    @include('public.style')
	<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <link type="text/css" href="/layui/v1.5/static/css/global.css?v=061704" rel="stylesheet">
    <link type="text/css" href="/layui/v1.5/static/css/index.css?v=061704" rel="stylesheet">
    <link type="text/css" href="/layui/v1.5/static/plugins/swiper/swiper.min.css" rel="stylesheet">
    <link type="text/css" href="/layui/v1.5/static/js/dropload/dropload.css?v=061704" rel="stylesheet">
    <style>
    .row {
    margin-right: -5px;
    margin-left: -5px;
}
</style>
</head>
<body class="white-body">
    @include('public.navbar')

<section class="main">
    <div class="top top-search" style="">
        <a class="class"><span class="icon-index-class"></span><span class="f-9">分类</span></a>
        <input class="search " id="search_key" value="" placeholder="搜索商品名称">
        <a class="icon-search-delete"></a>
        <a class="search-btn">搜索</a>
    </div>
    <div class="search-box hidden">
        <div class="history">
            <div class="history-title">
                <span>历史搜索</span><a class="float-right icon-delete"></a>
            </div>
            <div class="history-item">
                        <a>水孩儿</a>
                        <a>儿童羽绒服</a>
                        <a>草莓</a>
                        <a>挂钩</a>
                        <a>消毒水</a>
                        <a>一次性口罩</a>
                        <a>卫衣</a>
                        <a>汤臣倍健</a>
                        <a>耙耙柑</a>
                        <a>湿巾</a>
            </div>
            <div class="brand">
                <p>品牌推荐</p>
                <ul>
                            <li><img src="http://static.dakabl.com/upload/2019-10-30/a5f267e9-1c2d-40eb-91fd-2ac56eeef98a_s.png"><span>南极人</span></li>
                            <li><img src="http://static.dakabl.com/upload/2019-10-30/2c0aab76-f1fd-434a-b985-2ac9f799e814_s.png"><span>汤臣倍健</span></li>
                            <li><img src="http://static.dakabl.com/upload/2019-10-30/a1305835-6410-415e-9e8b-3e864621c906_s.png"><span>浪莎</span></li>
                            <li><img src="http://static.dakabl.com/upload/2019-10-30/c969c8d0-61a2-43a3-a810-4af11f5765fe_s.png"><span>猫人</span></li>
                            <li><img src="http://static.dakabl.com/upload/2019-10-30/0edb7d11-5041-4faa-a728-1871139e3357_s.png"><span>九阳</span></li>
                            <li><img src="http://static.dakabl.com/upload/2019-10-30/220fd828-5a2c-4fb5-beaa-bdc765115c75_s.png"><span>形象美</span></li>
                            <li><img src="http://static.dakabl.com/upload/2019-10-30/89eeaf57-b766-4b89-8eef-b01fac7e5075_s.png"><span>阿道夫</span></li>
                            <li><img src="http://static.dakabl.com/upload/2019-10-30/04295a71-07d7-4245-a9e8-4f26dec8b191_s.png"><span>雅鹿</span></li>
                            <li><img src="http://static.dakabl.com/upload/2019-10-30/f15fa30c-d9d0-46fa-98c1-4dadf554fefe_s.png"><span>和匠</span></li>
                            <li><img src="http://static.dakabl.com/upload/2019-10-30/f071d96f-5820-49c9-8e33-1774bb956308_s.png"><span>飞利浦</span></li>
                            <li><img src="http://static.dakabl.com/upload/2019-10-30/cdab0e82-ecb9-426c-bccf-d6096c1d54c5_s.png"><span>百雀羚</span></li>
                            <li><img src="http://static.dakabl.com/upload/2019-10-30/cd766251-8e69-43e7-8187-91257b5c74b2_s.png"><span>飞科</span></li>
                            <li><img src="http://static.dakabl.com/upload/2019-10-30/a3e77166-01fb-4dea-a5c1-c736b14fb62a_s.png"><span>志高</span></li>
                            <li><img src="http://static.dakabl.com/upload/2019-10-30/8b77cf18-764c-4667-b696-96ef812b2aa3_s.png"><span>小浣熊</span></li>
                            <li><img src="http://static.dakabl.com/v1.5/static/images/brand/hailan.png"><span>海澜之家</span></li>
                            <li><img src="http://static.dakabl.com/upload/2019-10-30/924a3fbf-26d2-4e38-aea8-18d993a9917b_s.png"><span>奥克斯</span></li>
                </ul>
            </div>
        </div>
        <div class="list-box goods goods-list" style="display:none;">
        </div>
    </div>
    <div class="tag-header hidden" style="display: none;">
        <ul class="sort top">
            <li><a class="active"><span class="icon-return" style="display: none;"></span>时间</a></li>
            <li><a><span class="icon-fabulous"></span><text>好评率</text></a></li>
            <li><a><span class="icon-hot1"></span>券后价</a></li>
            <li><a>佣金</a></li>
        </ul>
    </div>
    <div id="minirefresh" class="minirefresh-wrap minirefresh-theme-default">
        <div class="minirefresh-downwrap minirefresh-hardware-speedup status-default">
            <div class="downwrap-content">
                <p class="downwrap-progress"></p>
                <p class="downwrap-tips">下拉刷新</p>
            </div>
        </div><div class="minirefresh-scroll minirefresh-hardware-speedup">
            <div class="index-banner swiper-container swiper-container-horizontal" style="">
                <div class="swiper-wrapper" style="transform: translate3d(-750px, 0px, 0px); transition-duration: 300ms;"><div class="swiper-slide swiper-slide-duplicate" data-swiper-slide-index="2" style="width: 375px;">
                            <a href="" onclick="_hmt.push(['_trackEvent', 'banner', 'click', '2705721'])"><img src="http://static.dakabl.com/upload/2021-01-01/1d89a3ae-8768-4c21-8838-c54366b42628_o.jpg" width="100%"></a>
                        </div>
                        <div class="swiper-slide swiper-slide-prev" data-swiper-slide-index="0" style="width: 375px;">
                            <a href="" onclick="_hmt.push(['_trackEvent', 'banner', 'click', '2723217'])"><img src="http://static.dakabl.com/upload/2021-01-02/10a29d09-ba5e-47b2-a23c-3de3e4bb0128_o.jpg" width="100%"></a>
                        </div>
                        <div class="swiper-slide swiper-slide-active" data-swiper-slide-index="1" style="width: 375px;">
                            <a href="" onclick="_hmt.push(['_trackEvent', 'banner', 'click', '2731772'])"><img src="http://static.dakabl.com/upload/2021-01-02/289721db-76c3-4ae8-bc56-e418fa5a5ef8_o.jpg" width="100%"></a>
                        </div>
                        <div class="swiper-slide swiper-slide-next" data-swiper-slide-index="2" style="width: 375px;">
                            <a href="" onclick="_hmt.push(['_trackEvent', 'banner', 'click', '2705721'])"><img src="http://static.dakabl.com/upload/2021-01-01/1d89a3ae-8768-4c21-8838-c54366b42628_o.jpg" width="100%"></a>
                        </div>
                <div class="swiper-slide swiper-slide-duplicate" data-swiper-slide-index="0" style="width: 375px;">
                            <a href="" onclick="_hmt.push(['_trackEvent', 'banner', 'click', '2723217'])"><img src="http://static.dakabl.com/upload/2021-01-02/10a29d09-ba5e-47b2-a23c-3de3e4bb0128_o.jpg" width="100%"></a>
                        </div></div>
                <div class="swiper-pagination swiper-pagination-clickable swiper-pagination-bullets"><span class="swiper-pagination-bullet"></span><span class="swiper-pagination-bullet swiper-pagination-bullet-active"></span><span class="swiper-pagination-bullet"></span></div>
            </div>
            <div class="scroll-fixed">
                <div class="index-sp swiper-container-horizontal" style="">
                            <div class="swiper-slide">
                                <div class="slide-div"><a href="#" onclick="_hmt.push(['_trackEvent', 'column', 'click', '京仓京配'])" class="link-tag" data-icon="21"> <img src="http://static.dakabl.com/upload/2020-11-16/7a6df7ae-21e5-42a8-928e-01f0c6ece591_s.jpg" width="40">
                                        <p>京仓京配</p></a>
                                </div>
                            </div>
                            <div class="swiper-slide">
                                <div class="slide-div"><a href="../group/index.htm" onclick="_hmt.push(['_trackEvent', 'column', 'click', '精选线报'])"> <img src="http://static.dakabl.com/upload/2020-11-16/b2a077f1-12ff-4c63-a518-56338bfc1666_s.jpg" width="40">
                                        <p>精选线报</p></a>
                                </div>
                            </div>
                            <div class="swiper-slide">
                                <div class="slide-div"><a href="./fights.htm" onclick="_hmt.push(['_trackEvent', 'column', 'click', '疯抢榜单'])"> <img src="http://static.dakabl.com/upload/2020-11-16/19d939e5-fc85-4681-873a-2dcebd0286fc_s.jpg" width="40">
                                        <p>疯抢榜单</p></a>
                                </div>
                            </div>
                            <div class="swiper-slide">
                                <div class="slide-div"><a href="#" onclick="_hmt.push(['_trackEvent', 'column', 'click', '今日必推'])" class="link-tag" data-icon="24"> <img src="http://static.dakabl.com/upload/2020-11-16/55b1a310-4ad4-4190-9b78-f37eb304d382_s.jpg" width="40">
                                        <p>今日必推</p></a>
                                </div>
                            </div>
                            <div class="swiper-slide">
                                <div class="slide-div"><a href="#" onclick="_hmt.push(['_trackEvent', 'column', 'click', '白菜福利'])" class="link-tag" data-icon="25"> <img src="http://static.dakabl.com/upload/2020-11-16/8dc5a83d-3a90-42ab-bfad-baab8a2fd155_s.jpg" width="40">
                                        <p>白菜福利</p></a>
                                </div>
                            </div>
                            <div class="swiper-slide">
                                <div class="slide-div"><a href="#" onclick="_hmt.push(['_trackEvent', 'column', 'click', '品牌精选'])" class="link-tag" data-icon="26"> <img src="http://static.dakabl.com/upload/2020-11-16/3690c27f-a91f-402a-bc4c-54fa9e08cffb_s.jpg" width="40">
                                        <p>品牌精选</p></a>
                                </div>
                            </div>
                            <div class="swiper-slide">
                                <div class="slide-div"><a href="#" onclick="_hmt.push(['_trackEvent', 'column', 'click', '果蔬生鲜'])" class="link-tag" data-icon="27"> <img src="http://static.dakabl.com/upload/2020-11-16/511ec84a-0716-4d64-8cbc-8dd34ca8c170_s.jpg" width="40">
                                        <p>果蔬生鲜</p></a>
                                </div>
                            </div>
                            <div class="swiper-slide">
                                <div class="slide-div"><a href="#" onclick="_hmt.push(['_trackEvent', 'column', 'click', '防疫抗疫'])" class="link-tag" data-icon="29"> <img src="http://static.dakabl.com/upload/2020-11-16/be4329e8-a234-49b1-b49e-fc69b50b9943_s.jpg" width="40">
                                        <p>防疫抗疫</p></a>
                                </div>
                            </div>
                            <div class="swiper-slide">
                                <div class="slide-div"><a href="#" onclick="_hmt.push(['_trackEvent', 'column', 'click', '当季热销'])" class="link-tag" data-icon="28"> <img src="http://static.dakabl.com/upload/2020-11-16/26eff62f-4ca6-4275-85fb-741adff71c72_s.jpg" width="40">
                                        <p>当季热销</p></a>
                                </div>
                            </div>
                            <div class="swiper-slide">
                                <div class="slide-div"><a href="#" onclick="_hmt.push(['_trackEvent', 'column', 'click', '图书玩具'])" class="link-tag" data-icon="30"> <img src="http://static.dakabl.com/upload/2020-11-16/26e2eb60-0e3e-406f-b243-714e9fc51a48_s.jpg" width="40">
                                        <p>图书玩具</p></a>
                                </div>
                            </div>
                </div>
                <ul class="sort index-sort" style="">
                    <li><a class="active">时间</a></li>
                    <li><a><span class="icon-fabulous"></span><text>好评率</text></a></li>
                    <li><a><span class="icon-hot1"></span>券后价</a></li>
                    <li><a>佣金</a></li>
                </ul>
            </div>
				<!-- 这里显示商品 -->
                <div class="goods-container goods-list" style="margin-top: 0px;">
                    <div class="list-box"><!-- 0 -->


<!-- 这里结束显示商品 -->
</div>
                </div>
        <div class="minirefresh-upwrap minirefresh-hardware-speedup status-default" style="visibility: hidden;">
            <p class="upwrap-progress"></p>
            <p class="upwrap-tips"></p>
        </div></div>
    <div class="minirefresh-totop minirefresh-theme-default minirefresh-hidden"></div></div>
    <!--客户按钮-->

    <!--线报按钮-->
    <div class="xb_tips tool-container" style="display:none;">
        <ul>
            <li class="hidden thread-btn-group"><a class="btn-thread-edit">查看商品(<span id="xb_tips_num">1</span>)</a></li>
            <li class="hidden thread-btn-group"><a class="btn-share-image">分享图片</a></li>
            <li class="hidden thread-btn-group"><a class="btn-copy btn-thread-copy">复制线报</a></li>
            <li class="xb-back"><a><i class="icon-xb-back"></i><span class="text">返&nbsp;&nbsp;回</span></a></li>
        </ul>
    </div>
    <!--线报按钮结束-->
    <!--隐藏域-->
    <input type="hidden" id="bind_id" value="0"><!--是否绑定,0-未绑定，1-已绑定-->

    <input type="hidden" id="bind_type" value="0"><!--按钮标记，0-一键推广，1-加入线报，用于未绑定时弹窗文字显示-->
    <!--隐藏域结束-->
</section>
<section class="thread-container hidden">
    <div class="list-box goods">
    </div>
    <div class="detail-footer goods-footer bottom-btn-group">
        <a class="btn-back">返回</a>
        <a class="btn-copy f-16">复制线报</a>
        <a class="btn-share btn-share-image f-16">分享图片</a>
    </div>
</section>

<!-- sidebar代码 开始 -->
<div class="wrapper hidden">
    <div class="toolbar">
        <div id="open-sb" class="menu-button menu-left"></div>
    </div>
    <section class="sidebar" style="z-index: 3000; position: fixed; top: 0px; left: 0px; bottom: 0px; width: 200px; margin-left: -200px; height: 812px;"><div data-ssbplugin="sub-wrapper" style="width: 100%; height: 100%; overflow: auto;">
        <nav>
            <ul>
                <li><a href="./index.htm" class="type_link active" data-value=""><span><i class="icon-all"></i></span>全部</a></li>
                <li><a href="./index.htm?category=1" class="type_link" data-value="1"><span><i class="icon-cloth"></i></span>服装(7149)</a></li>
                <li><a href="./index.htm?category=2" class="type_link" data-value="2"><span><i class="icon-muying"></i></span>母婴玩具(3019)</a></li>
                <li><a href="./index.htm?category=3" class="type_link" data-value="3"><span><i class="icon-meihu"></i></span>美妆个护(3881)</a></li>
                <li><a href="./index.htm?category=4" class="type_link" data-value="4"><span><i class="icon-jujia"></i></span>居家生活(5840)</a></li>
                <li><a href="./index.htm?category=5" class="type_link" data-value="5"><span><i class="icon-xiebao"></i></span>鞋品箱包(1052)</a></li>
                <li><a href="./index.htm?category=6" class="type_link" data-value="6"><span><i class="icon-food"></i></span>美食(5872)</a></li>
                <li><a href="./index.htm?category=7" class="type_link" data-value="7"><span><i class="icon-wenti"></i></span>文体车品(2137)</a></li>
                <li><a href="./index.htm?category=8" class="type_link" data-value="8"><span><i class="icon-digit"></i></span>数码电器(2899)</a></li>
            </ul>
        </nav>
    </div></section>
</div>
<!-- sidebar代码 结束 -->
<!--绑定id弹窗-->
<div id="layer_id" class="hidden">
    <div class="layer-div">
        <img src="//static.dakabl.com/v1.5/static/images/id-bj.png" width="100%" height="108">
        <p class="title">绑定联盟ID</p>
        <p class="text">绑定京东联盟ID后，推广即可获取收益，快去绑定哦~</p>
        <p class="text">转链失败，请先去绑定京东联盟ID哦~</p>
        <a href="//m.dakabl.com/user/config.htm" class="red-btn">去绑定</a>
        <span class="icon-layer-line"></span>
        <a class="icon-layer-close"></a>
    </div>
</div>
<!--绑定id弹窗结束-->
<script src="/layui/v1.5/static/plugins/swiper/swiper.min.js"></script>
<script src="/layui/v1.5/static/plugins/sidebar/jquery.simplesidebar.js"></script>
<script src="/layui/v1.5/static/plugins/layer/mobile/layer.js?v=061704"></script>
<link rel="stylesheet" type="text/css" href="/layui/v1.5/static/plugins/minirefresh/minirefresh.min.css">
<script src="/layui/v1.5/static/plugins/minirefresh/minirefresh.min.js"></script>
<script src="/layui/v1.5/static/js/goods/index.js?v=061704"></script>
<script src="/layui/v1.5/static/js/global.js?v=061704"></script>
	@include('public.script')

<script>
	/*一键推广btn*/
	 function tg_btn(obj) {
	   var goods = $(obj).parents(".list");
	   var id = goods.data("id");
	   var url = "/user/daka_goods_add";//数据接口，一键推广
	   console.log(id);
	   $.ajax({
	       type: 'POST',
	       url: url,
	       data: {id: id},
	       dataType: 'json',
           headers: {
                       'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                   },
	       success: function (data) {
				  layer.msg(data.msg);
	       },
	       error: function () {
	           layer.msg("error:推送失败，请联系管理员");
	       }
	   });

	}
    /*banner */

    var limit = 40;
    var category = "";
    var iconId = "";
    var queryType=0;
    var index_banner = new Swiper('.index-banner',{
        loop: true,
        autoplay: 4000,
        pagination: '.index-banner .swiper-pagination',
        paginationClickable: true,
        autoplayDisableOnInteraction : false
    });
    /*京仓京配等类别 */
    var index_sp = new Swiper('.index-sp',{
        autoplay: false,
        slidesPerView: 5,
        spaceBetween: 10
    });

    var total = 35305;
    var requestDelayTime = 200;
    var goodsListArr = ['','','',''];
	// http://127.0.0.1/daka/goods/list1.htm?start=40&limit=40&category=&iconId=&_=1609648671365
    var urlArr = ['/user/daka_list','../php/list4.htm','../php/list5.htm','../php/list2.htm'];//数据接口
	//list1时间、list4好评率、list5券后价、list2佣金

    var miniRefresh = new MiniRefresh({
        container: '#minirefresh',
        // container: '.main',
        down: {
            callback: function() {
                console.log("down............");
                setTimeout(function() {
                    ajax_load_data(1);
                }, requestDelayTime);
            }
        },
        up: {
            isAuto: false,
            callback: function() {
                console.log("up............");
                setTimeout(function() {
                    ajax_load_data(0)
                }, requestDelayTime);
            }
        }
    })

    var loading  = 0;
    function ajax_load_data(reload) {
        var $container = $('.goods-list .list-box');
        var url = urlArr[queryType];
        var start = $container.find(".list").length;
		console.log("ajax_load_data(reload)+url:"+url+"-start:"+start);
        if (typeof reload != "undefined" && reload == 1) {
            start = 0;
        }
        if (loading == 1){
            return false;
        }
        // loading = 1;
        $.ajax({
            type: 'GET',
            url: url,
            data: {start: start, limit: start==0?40:limit,category:category,iconId:iconId},
            dataType: 'text',
            async:false,
            success: function (data) {
                if (typeof reload != "undefined" && reload == 1) {
                    $container.html(data);
                    miniRefresh.endDownLoading(true);
                }else{
                    $container.append(data);
                }
                reloadThreadList();
                miniRefresh.endUpLoading($container.find(".list").length >= total ? true : false);
                loading = 0;
            },
            error: function (xhr, type) {
                loading = 0;
            }
        });
    }
    /**
     * 切换排序方式
     **/
    $(".sort a").click(function (e) {

        var $this = $(this);
        if ($this.hasClass("active")){
            return false;
        }

        var $container = $('.goods-list .list-box');
        goodsListArr[queryType] = $container.html();

        queryType = $this.parent().index();

        $container.html(goodsListArr[queryType]);

        $(".sort a").removeClass("active")
        $this.addClass("active")
        if (goodsListArr[queryType] == ''){
            ajax_load_data(1);
        }else{
            miniRefresh.endUpLoading($container.find(".list").length >= total ? true : false);
        }

        miniRefresh.endDownLoading(false);

        return false;

    });

    function initRedPacketCopy(url) {
        var clipboard = new ClipboardJS(".navigation .red-packet", {
            text: function (trigger) {
                var wenan = "[红包][红包]【京东618狂撒京喜红包！！】\n" +
                    "\n" +
                    "\uD83D\uDE31最高618元任性抢！每人每天3次机会！必抢中！\n" +
                    "\uD83D\uDE80先抢先得！使用无门槛！任意叠加使用！\n" +
                    "\n" +
                    "\uD83D\uDCCD 抓紧拆，最高抢\uD83D\uDCB4618\uD83D\uDC47\n" +
                    "┏━━━━━━━━━━┓ \n" +
                    url + "\n" +
                    "┗━━━━━━━━━━┛\n" +
                    "⚠分享还可获奖励[色]一起薅羊毛~\n" +
                    "\n" +
                    "⏰抢红包时间5月30日零点--6月20日！";
                return wenan;
            }
        });

        clipboard.on('success', function (e) {
            $.toast("复制红包成功，请前往粘贴", 'text');
            e.clearSelection();
        });
        clipboard.on('error', function (e) {
            console.log("error",e);
            $.toast("复制红包失败", 'text');
            e.clearSelection();
        });
    }

    $(document).ready(function(e) {
        /*首次*/
		console.log("web is ready");
		var $container = $('.goods-list .list-box');
		var url = "/user/daka_list";//数据接口，渲染页面
		$.ajax({
		    type: 'GET',
		    url: url,
		    data: {start: "0", limit: "40",category:"",iconId:""},
		    dataType: 'text',
		    async:false,
		    success: function (data) {

		            $container.html(data);

		    },
		    error: function (xhr, type) {

		          layer.msg('加载数据失败，请联系管理员');

		    }
		});

		// $(document).on('click','.extension_btn',function(){
		// 	layer.msg("你点击了一键推送");
		// 	var goods = $this.parents(".list");
		// 	var id = goods.data("id");
		// 	console.log(id);
		    // if($('#bind_id').val()==1){
		    //     /*已绑定*/
		    //     getRecommendWenan(this);
		    //     // $(this).html('复制文案');
		    //     // $(this).data('content','文案内容');
		    //     // $(this).addClass('btn-copy');
		    // }else{
		    //     /*未绑定，弹窗*/
		    //     var type=$('#bind_type').val();
		    //     $('#layer_id').find('.text').hide();
		    //     $('#layer_id').find('.text:eq('+type+')').show();
		    //     layer.open({
		    //         content: $('#layer_id').html()
		    //         ,style: 'width: 70%'
		    //         ,skin:'id'
		    //     });
		    // }
		    // $('.xb_tips').hide();
		    // return false;
		//});

		/*分类点击,sidebar */
        $.ajaxSetup({
            cache: false
        });


        $('.sidebar' ).simpleSidebar({
            settings: {
                opener: '#open-sb',
                wrapper: '.wrapper',
                animation: {
                    duration: 500,
                    easing: 'easeOutQuint'
                }
            },
            sidebar: {
                align: 'left',
                width: 200,
                closingLinks: '.type_link',
            }
        });

        $('#open-sb').click(function(e) {
            if ($('.btn-newspaper:visible').length ==0 ){
                return false;
            }

            $('.wrapper').show();
            $("body").animate({marginLeft:"200px"});
            $('.sidebar').animate({marginLeft:"0px"});
            $( 'body, html' ).css({
                overflow: 'hidden'
            });
        });
        $('.top .class').click(function(e) {

            if ($('.btn-newspaper:visible').length ==0 ){
                return false;
            }
            $('#open-sb').click();
        });


        /*线报按钮 */
        $('.xb-back').click(function(e) {
            $('.btn-newspaper').show();
            $('.btn-agent').show();
            $('.xb_tips').hide();
        });

        // $(document).on('click','.validity',function(){
        //     $(this).parents('.list').find('.extension_btn').click();
        //     $(this).parents('.list').find('.btn-copy').click();
        // });

        /*关闭弹窗*/
        $(document).on('click','.icon-layer-close',function(){
            layer.closeAll();
        });

        var windowHeight = $(window).height(),
        $body = $('.sidebar');
        $body.css("height", windowHeight); //重要代码

        // var mini_h=windowHeight;
        // $('.minirefresh-wrap').css('height',mini_h+'px');



        /*分类点击事件*/
        $('.sidebar').on('click','.type_link',function(){
            var $this = $(this);
            console.log($this.text());
            if ($this.hasClass("active")){
                return false;
            }

            $('.type_link').removeClass('active');
            $this.addClass('active');

            $(window).trigger("resize");
            category = $this.data("value");
            iconId = "";
            $(".goods-list .list-box").html("");
            goodsListArr = ['','','',''];
            ajax_load_data(queryType,1);
            return false;
        });

        /*分类点击事件*/
        $('.index-sp').on('click','.link-tag',function(){
            var $this = $(this);

            $('.type_link').removeClass('active');
            $('.type_link:first').addClass('active');

            $(window).trigger("resize");
            $(".icon-return").show();
            $(".swiper-container").hide();
            $(".index-sp").hide();
            $(".top-search").hide();
            $(".tag-header").show();
            $(".minirefresh-wrap .sort").hide();
            $(".goods-container ").css({"margin-top":"45px"});
            $('#minirefresh').scrollTop();

            $(".tag-header ul li").find("a").eq(queryType).addClass("active");
            category = "";
            iconId = $this.data("icon");
            $(".goods-list .list-box").html("");
            goodsListArr = ['','','',''];
            ajax_load_data(queryType,1);

            return false;
        });

        $(".icon-return").click(function () {
            $(this).hide();
            $(".swiper-container").show();
            $(".index-sp").show();
            $(".top-search").show();
            $(".tag-header").hide();
            $(".minirefresh-wrap .sort").show();
            $(".goods-container ").css({"margin-top":"0px"});
            $('#minirefresh').scrollTop();
            $(window).trigger("resize");
            category = "";
            iconId = "";
            $(".index-sort li").find("a").eq(queryType).addClass("active");
            $(".goods-list .list-box").html("");
            goodsListArr = ['','','',''];

            ajax_load_data(queryType,1);
            return false;
        });


        /*固定分类和排序*/
        $(window).scroll(function(e) {
            var s_h=$(window).scrollTop();
            if(s_h>218){
                $('.scroll-fixed').addClass('fixed');
            }else{
                $('.scroll-fixed').removeClass('fixed');
            }
        });

        $(document).on('click','.btn-area',function(e){
            $(this).parents('.list').find('button:visible').click();
            $(this).parents('.list').find('button:visible').trigger("touchstart");
        });


        $(".top .search").click(function () {
            if ($(this).parents(".top").hasClass("search-top")) {
                return false
            }
            $("#minirefresh").hide();
            $(".kefu").hide();

            $(this).parents(".top").addClass("search-top");
            $(".search-box").show();
            $(".search-box .history").show();
            $(".search-box .goods-list").hide();

        });

        $(".top .icon-search-delete").click(function () {
            $(this).parents(".top").removeClass("search-top");

            $("#minirefresh").show();
            $(".kefu").show();

            $(".top .search").val("");
            $(".search-box").hide();
            $(".search-box .goods-list").html("");


        });

        $(".icon-delete").click(function () {
            layer.open({
                content: '确认删除全部搜索记录？'
                , btn: ['确定', '取消']
                , yes: function (index) {
                    $.ajax({
                        type: 'POST',
                        url: "delSearch.htm",
                        dataType: 'json',
                        success: function (data) {
                            if (data.errcode == "0") {
                                $(".history-item").remove();
                                layer.close(index);
                            }
                        },
                        error: function (xhr, type) {
                        }
                    });
                }
            });
        });

        $(".history-item a").click(function () {
            var key = $(this).text().trim();
            if (key == "") {
                return false;
            }
            $("#search_key").val(key);
            search();
        });
        $(".brand ul>li").click(function () {
            var key = $(this).find("span").text();
            $("#search_key").val(key);
            search();
        });
        $('.search-btn').click(function (e) {
            search();
        });

        $("#search_key").on('keydown', function(e) {
            console.log("keydown:" + e.keyCode);
            var key = $(this).val().trim();
            console.log(key,key.length);
            if(e.keyCode == '8' && key == "" || key.length == 1 ) {
                $(".search-box .history").show();
                $(".search-box .goods-list").hide();
            }
        });

        $("#search_key").on('keypress', function(e) {
            console.log("keypress:" + e.keyCode);
            if(e.keyCode == '13') {
                $('.search-btn').click();
            }
        });


        /* 搜索 */
        function search() {
            var start = $(".search-box .list-box .list").length;
            var key = $("#search_key").val().trim();
            if (key == ""){
                return false;
            }

            showLoading("拼命搜索中")
            $.ajax({
                type: 'GET',
                url: 'searchList.htm',
                data: {start: 0, limit: 40, key: key},
                dataType: 'text',
                success: function (data) {
                    hideLoading();
                    $(".search-box .history").hide();
                    $(".search-box .goods-list").show();
                    $(".search-box .list-box").html(data);
                    reloadThreadList();
                },
                error: function (xhr, type) {
                    hideLoading();
                }
            });
            return false;
        }
    });
</script>
<script>
    var _hmt = _hmt || [];
    (function() {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?6176d8ceb5283d699c25a8bcbb507a9e";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
    })();
</script>


<div data-ssbplugin="mask" style="background-color: rgb(0, 0, 0); opacity: 0.5; position: fixed; inset: -200px; z-index: 2999; display: none;"></div></body></html>
